package com.topscomm.file.convert.aspose;

import java.io.InputStream;

import com.topscomm.basic.util.Config;

/**
 * @description: 设置Aspose的证书
 * @author: wanghongwei
 * @date: 2021-3-18 9:52:13
 * @modify:
 */
public class AsposeSetLicense {
	/**
	 * ASPOSE_LICENSE注册路径
	 */
	private static final String ASPOSE_LICENSE = Config.getInstance().getValue("aspose_license");

	/**
	 * @description: 设置excel的license
	 * @author: wanghongwei
	 * @date: 2021-3-18 10:11:57
	 * @modify:
	 */
	public static void setExcelAsposeLicense() {
		InputStream is = AsposeSetLicense.class.getClassLoader().getResourceAsStream(ASPOSE_LICENSE);
		com.aspose.cells.License asposeLic = new com.aspose.cells.License();
		asposeLic.setLicense(is);
	}

	/**
	 * @description: 设置word的license
	 * @throws Exception
	 * @author: wanghongwei
	 * @date: 2021-3-18 10:17:50
	 * @modify:
	 */
	public static void setWordAsposeLicense() throws Exception {
		InputStream is = AsposeSetLicense.class.getClassLoader().getResourceAsStream(ASPOSE_LICENSE);
		com.aspose.words.License asposeLic = new com.aspose.words.License();
		asposeLic.setLicense(is);
	}

	/**
	 * @description: 设置ppt的license
	 * @throws Exception
	 * @author: wanghongwei
	 * @date: 2021-3-18 10:17:50
	 * @modify:
	 */
	public static void setPowerPointAsposeLicense() {
		InputStream is = AsposeSetLicense.class.getClassLoader().getResourceAsStream(ASPOSE_LICENSE);
		com.aspose.slides.License asposeLic = new com.aspose.slides.License();
		asposeLic.setLicense(is);
	}

	/**
	 * 
	 * @description:
	 * @author: donghang
	 * @throws Exception
	 * @date: 2021年5月23日下午8:11:45
	 * @modify:
	 */
	public static void setPdfAsposeLicense() throws Exception {
		InputStream is = AsposeSetLicense.class.getClassLoader().getResourceAsStream(ASPOSE_LICENSE);
		com.aspose.pdf.License asposeLic = new com.aspose.pdf.License();
		asposeLic.setLicense(is);
	}
}
